package com.mlyol.singleton;

public class Demo3 {

    public static void main(String[] args) {
        Demo3 instance1 = Demo3.getInstance();
        Demo3 instance2 = Demo3.getInstance();
        System.out.println(instance1==instance2);
    }

    private Demo3() {

    }

    private static Demo3 instance;

    public static Demo3 getInstance() {
        if (instance == null) {
            instance = new Demo3();
        }
        return instance;
    }


}
